import request from '@/utils/request'
import { getToken } from '@/utils/auth'

// 出货明细列表
export function fetchList(query) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/pas/shipment/getShipments',
    method: 'get',
    params: query
  })
}
// 下载
export function download(query) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/pas/shipment/downloadShipment',
    method: 'get',
    params: query
  })
}

// 通过id查找出货明细
export function queryById(shipmentId) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/pas/shipment/queryById/' + shipmentId,
    method: 'get',
    params: null
  })
}

// 加载仓库
export function queryList(query) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/pas/warehouse/queryList',
    method: 'get',
    params: query
  })
}

// 转仓
export function warehouseTransfer(query) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/pas/shipment/warehouseTransfer',
    method: 'post',
    params: query
  })
}

// 转采购
export function purchaseTransfer(query) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/pas/shipment/purchaseTransfer',
    method: 'post',
    params: query
  })
}

//
// 快递公司列表
export function getExpressCompanys() {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/pas/express/getExpressCompanys',
    method: 'get',
    params: null
  })
}

// 发货
export function confirmShipment(query) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/pas/shipment/confirmShipment',
    method: 'post',
    params: query
  })
}

// 发货履历
export function getShipmenHistory(query) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/pas/shipment/getShipmenHistory',
    method: 'get',
    params: query
  })
}
// 修改收货信息
export function updateReceivingGoods(param) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/pas/shipment/updateReceivingGoods',
    method: 'post',
    params: param
  })
}
